package whitefox.gqtcard.dblocation;

import java.util.ArrayList;

import whitefox.gqtcard.MapActivity;
import whitefox.gqtcard.R;
import whitefox.gqtcard.adapter.CheckAdapter;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

public class CheckLocation extends Activity {

	ListView lvLocation;
	Button btnAdd, btnRemove, btnUpdate;
	ArrayList<whitefox.gqtcard.dblocation.Location> ListLocation;
	ArrayAdapter<whitefox.gqtcard.dblocation.Location> adapter = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_check_location);
		btnAdd = (Button) findViewById(R.id.cl_btnAdd);
		btnRemove = (Button) findViewById(R.id.cl_btnRemove);
		btnUpdate = (Button) findViewById(R.id.cl_btnUpdate);
		lvLocation = (ListView) findViewById(R.id.listView1);

		final DBLocation dbl = new DBLocation(this);
		ListLocation = new ArrayList<whitefox.gqtcard.dblocation.Location>();
		ListLocation = dbl.findall();
		adapter = new ArrayAdapter<Location>(this,
				android.R.layout.simple_list_item_1, ListLocation);
		lvLocation.setAdapter(adapter);
		
		btnAdd.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(CheckLocation.this, MapActivity.class);
				startActivity(intent);
				
			}
		});
		
		btnRemove.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				
			}
		});
	}

}
